<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:f="http://java.sun.com/jsf/core">

<ui:composition template="../../../templates/padrao.xhtml">
<ui:define name="menu">
		<p:tabMenu style="border:0;" activeIndex="5">
			<p:menuitem url="/view/index1.xhtml" value="Inicio" />
			<p:menuitem url="/view/usuarios/admin/user/listUser.xhtml"
				value="Clientes" />
			<p:menuitem url="/view/usuarios/admin/produto/listProd.xhtml"
				value="Produtos" />
			<p:menuitem url="/view/usuarios/admin/compra/listcompra.xhtml"
				value="Fornecedor" />
			<p:menuitem url="/view/usuarios/admin/compra/listcompra.xhtml"
				value="Vendas" />
			<p:menuitem url="/view/usuarios/admin/fornecedor/listComp.xhtml"
				value="Compra" />
			<p:menuitem url="/view/usuarios/admin/compra/listcompra.xhtml"
				value="Relatorio" />
		</p:tabMenu>
	</ui:define>
	<ui:define name="conteudo">
		<h:form id="form">
			<h:inputHidden value="#{compraBean.compra.id}"/>
			<p:panel header="Cadastro de Fornecedor" id="panel">
				<h:panelGrid id="pn" columns="2" style="margin-bottom:10px" styleClass="">
					<f:facet name="header">
						<p:messages />
					</f:facet>
					
					<h:outputLabel for="fornecedor" value="Fornecedor: *" />
					<h:selectOneMenu id="fornecedor" value="#{compraBean.fornecedor}" style="width:200px" converter="FornecedorConverter" >
						 <f:selectItem itemLabel="---------" itemValue="0"></f:selectItem> 
						<f:selectItems value="#{fornecedorBean.fornecedores}" var="fornecedor" itemLabel="#{fornecedor.nome}"/>
					</h:selectOneMenu>

					<h:outputLabel for="produto" value="Produto: *" /> 
					<p:selectOneMenu id="produto" value="#{compraBean.fornecedor}" style="width:200px">
						
						<f:selectItems value="#{produtoBean.produtos}" var="produto" itemLabel="#{produto.nome}"/>
					</p:selectOneMenu>
					
					<h:outputLabel for="produto" value="Produto: *" />
					<p:inputText id="qnt" value="#{compraBean.compra.qnt}" required="true" requiredMessage="Quantidade necessaria"/>
								
					
					
					
				</h:panelGrid>
				
			</p:panel>

			<h:panelGrid columns="6" cellpadding="5">
				<p:commandButton value="Enviar" id="btnOk"
					update="panel" action="#{compraBean.salvar}" ajax="false"/>
					
				<p:button value="Listar" id="lista" outcome="listComp" />
			</h:panelGrid>
		</h:form>
	</ui:define>


</ui:composition>
</html>
